<?php
/* @var $this ImageController */
/* @var $model Image */
/* @var $form CActiveForm */
?>
 <div id="sidebar">
<?php
	$this->beginWidget('zii.widgets.CPortlet');
	$this->widget('zii.widgets.CMenu', array(
		'items'=>$this->menu,
		'htmlOptions'=>array('class'=>'operations'),
	));
	$this->endWidget();
?>
</div><!-- sidebar -->

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'image-form',
   	'enableAjaxValidation'=>false,
 	'htmlOptions' => array('enctype' => 'multipart/form-data'),		
)); ?>

	<p class="note"><span class="required">*</span> Champs requis.</p>
	<div class="row">
		<?php echo $form->errorSummary($model); ?>
		
		<?php echo "Area" ?>
			
		<?php  echo Chtml::dropDownList('id_area', '',
	
        CHtml::listData(Area::model()->findAll(), 'id', 'name'),
									array(
									'prompt'=>'Sélectionnez une région',
									'options' => ($model->isNewRecord) ?  '' : array($model->idLocation->id_area=>array('selected'=>true)),
									'ajax' => array(
									'type'=>'POST', 
									'url'=>CController::createUrl('Image/DynamicAreas'), 
									'update'=>'#id_location',		
									)));
		?>
	</div>
	
	<div class="row">
		<?php echo $form->labelEx($model,'id_location'); ?>
		<?php echo $form->dropDownList($model,'id_location', ($model->isNewRecord) ?  array() : CHtml::listData(Location::model()->findAll(), 'id', 'name'),array('prompt'=>'Sélectionnez un lieu','id'=>'id_location'));?>
		<?php echo $form->error($model,'id_location'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'path'); ?>
		<?php echo $form->fileField($model, 'path'); ?>
		<?php echo $form->error($model,'path'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'type'); ?>
		<?php echo $form->dropDownList($model,'type', array('0'=>'Standard','1'=>'Principale')); ?>
		<?php echo $form->error($model,'type'); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Enregsitrer' : 'Sauvegarder'); ?>
	</div>
	
<?php $this->endWidget(); ?>

</div><!-- form -->